# -*- coding:utf8 -*- #
# -----------------------------------------------------------------------------------
# ProjectName:  smalleel-api-tools
# FileName:     updatePrice.py
# Author  :
# Datetime:     2023/9/4 21:58
# Description：
# -----------------------------------------------------------------------------------
from common.util.requestUtil.requestUtil import RequestsUtil
from tool.process.smalleelLogin import Login
from tool.process.config.smalleelApi import SmalleelApi, MerchantApi

login = Login()
res = RequestsUtil()


def updatePrice_smalleel():
    token = login.login_smalleel_return()
    header = {"Authorization": token}
    url = SmalleelApi.updatePrice
    params = {
        "ids": "1683396949812428801,1631206732852027393,1631218558838956034,1631218560582291458,1631218562437668866,1631218563899985921,"
               "1631218565721808898,1631218567221874689,1631218568991870978,1631218570583007234,1631218572229873665,1631218575631454210,"
               "1631218577281310721,1631218578974314498,1631218580682891266,1631218582989758466,1631218584489824258,1631218587356028929,"
               "1631218590430453761,1631218592731631617,1631218594897387522,1631218596594585601,1631218598248636417,1631218599924862977,"
               "1631218601608273921,1631218603351609346,1631218604959522817,1631218606207930369,1631218607933284354,1631218609643065346,"
               "1631218611922067458,1631218614017724417,1631218616527413249,1631218618371411969,1631218620721717249,1631218622579793921,"
               "1631218624256020481,1631218625947820034,1631218628035088385,1631218629722693634,1631218631709298689,1631218633732448258,"
               "1631218635572252674,1631218637104668673,1631218638827032577,1631218640573358081,1631218642291527681,1631218644042047490,"
               "1631218645651165185,1631218647288438786,1631218649331064833,1631218651107954689,1631218653525368833,1631218655696523266,"
               "1631218657468014593,1631218659450425346,1631218661167390722,1631218663204327425,1631218664883544066,1631218666626879490,"
               "1631218668401070082,1631218670213009409,1631218671682510850,1631218673371320321,1631218675453190146,1631218677108445186,"
               "1631218679160954882,1631218680883318785,1631218682604478466,1631218684247150593,1631218685913784321,1631218687644536834,"
               "1631218689319559169,1631218691167752193,1631218692872134658,1631218694619664386,1631218696714117122,1631218698579087362,"
               "1631218700627402753,1631218702274269185,1631218704712654850,1631218706510516225,1631218708420419586,1631218710084063234,"
               "1631218711708753922,1631218713527586817,1631218715307466754,1631218717264711682,1631218719287861249,1631218721232523265,"
               "1631218723125649409",
        "feetype": 1,
        "priceType": 1,
        "priceContent": 0.785,
        "plusPrice": 1.22,
        "optPwd": "7a7a38347a860e444959a3cebc5d1128"}
    req = res.send_request("post", url, params, "data", headers=header)
    print(req)


def batchUpdatePrice_smalleel():
    token = login.login_smalleel_return()
    header = {"Authorization": token}
    url = SmalleelApi.batchUpdatePrice
    params = {"priceType": 1,
              "bjlx": 1,
              "priceContent": "0.78",
              "priceContentView": "",
              "plusPrice": 0.12,
              "optPwd": "7a7a38347a860e444959a3cebc5d1128",
              "proid": 1631190338328903682}
    req = res.send_request("post", url, params, "data", headers=header)
    print(req)


def updatePrice_merchant():
    token = login.login_merchant_return()
    header = {"Authorization": token, "optPwd": "7a7a38347a860e444959a3cebc5d1128"}
    url = MerchantApi.merchantUpdatePrice
    params = {
        "dbId": "1695992700215140353",
        "plusPrice": 8.999999,
        "priceContent": 10086.999999,
        "priceType": 1}
    req = res.send_request("post", url, params, "json", headers=header)
    print(req)


if __name__ == '__main__':
    # updatePrice_smalleel()
    # batchUpdatePrice_smalleel()
    updatePrice_merchant()
